var a = ['1644168458154844162', '1644171700314087426', '1644170908853116929']
var list = [{
    "id": "1645974496524894210",
    "parentId": "0",
    "deptName": "一级组织架构",
    "deptCategory": -1,
    "responsibilityUserId": "1645974498131312641",
    "hasChildren": false,
    "responsibilityUserName": "张三",
    "responsibilityUserAccount": "15666555555"
}, {
    "id": "1644157848620933121",
    "parentId": "0",
    "deptName": "测试不选上级",
    "deptCategory": -1,
    "responsibilityUserId": "1644157848620933121",
    "children": [{
        "id": "1644172257514790914",
        "parentId": "1644157848620933121",
        "deptName": "测试新增人员",
        "deptCategory": -1,
        "responsibilityUserId": "1640550604273209345",
        "children": [{
            "id": "1644172816175112194",
            "parentId": "1644172257514790914",
            "deptName": "测试新增人员",
            "deptCategory": -1,
            "responsibilityUserId": -1,
            "hasChildren": false,
            "responsibilityUserName": "",
            "responsibilityUserAccount": ""
        }],
        "hasChildren": false,
        "responsibilityUserName": "刘欣2",
        "responsibilityUserAccount": "15069132762"
    }, {
        "id": "1644173111915487234",
        "parentId": "1644157848620933121",
        "deptName": "测试新增人员4",
        "deptCategory": -1,
        "responsibilityUserId": -1,
        "hasChildren": false,
        "responsibilityUserName": "",
        "responsibilityUserAccount": ""
    }, {
        "id": "1644176445971931138",
        "parentId": "1644157848620933121",
        "deptName": "测试人员五",
        "deptCategory": -1,
        "responsibilityUserId": -1,
        "hasChildren": false,
        "responsibilityUserName": "",
        "responsibilityUserAccount": ""
    }, {
        "id": "1644215463132606466",
        "parentId": "1644157848620933121",
        "deptName": "测试新增a",
        "deptCategory": -1,
        "responsibilityUserId": "1644215463761752065",
        "hasChildren": false,
        "responsibilityUserName": "于洪宇",
        "responsibilityUserAccount": "15756565644"
    }, {
        "id": "1644230418439417858",
        "parentId": "1644157848620933121",
        "deptName": "测试新增人员123",
        "deptCategory": -1,
        "responsibilityUserId": -1,
        "hasChildren": false,
        "responsibilityUserName": "",
        "responsibilityUserAccount": ""
    }, {
        "id": "1644161425057816577",
        "parentId": "1644157848620933121",
        "deptName": "测试树中新增",
        "deptCategory": -1,
        "responsibilityUserId": -1,
        "hasChildren": false,
        "responsibilityUserName": "",
        "responsibilityUserAccount": ""
    }, {
        "id": "1644168458154844162",
        "parentId": "1644157848620933121",
        "deptName": "测试选择已有负责人",
        "deptCategory": -1,
        "responsibilityUserId": "1640550604273209345",
        "children": [{
            "id": "1644171700314087426",
            "parentId": "1644168458154844162",
            "deptName": "测试选择新增2",
            "deptCategory": -1,
            "responsibilityUserId": "1640550604273209345",
            "hasChildren": false,
            "responsibilityUserName": "刘欣2",
            "responsibilityUserAccount": "15069132762"
        }, {
            "id": "1644170908853116929",
            "parentId": "1644168458154844162",
            "deptName": "测试选择新增",
            "deptCategory": -1,
            "responsibilityUserId": "1640550604273209345",
            "hasChildren": false,
            "responsibilityUserName": "刘欣2",
            "responsibilityUserAccount": "15069132762"
        }, {
            "id": "1644170994882486273",
            "parentId": "1644168458154844162",
            "deptName": "测试选择新增1",
            "deptCategory": -1,
            "responsibilityUserId": "1640550604273209345",
            "hasChildren": false,
            "responsibilityUserName": "刘欣2",
            "responsibilityUserAccount": "15069132762"
        }],
        "hasChildren": false,
        "responsibilityUserName": "刘欣2",
        "responsibilityUserAccount": "15069132762"
    }],
    "hasChildren": false,
    "responsibilityUserName": "测试",
    "responsibilityUserAccount": "15444555555"
}, {
    "id": "1644162713782886402",
    "parentId": "0",
    "deptName": "选择了空",
    "deptCategory": -1,
    "responsibilityUserId": -1,
    "hasChildren": false,
    "responsibilityUserName": "",
    "responsibilityUserAccount": ""
}, {
    "id": "1638828389840322562",
    "parentId": "0",
    "deptName": "中华民航机场",
    "deptCategory": -1,
    "responsibilityUserId": -1,
    "children": [{
        "id": "1644175392367460353",
        "parentId": "1638828389840322562",
        "deptName": "巡检三组0407",
        "deptCategory": -1,
        "responsibilityUserId": -1,
        "hasChildren": false,
        "responsibilityUserName": "",
        "responsibilityUserAccount": ""
    }, {
        "id": "1644256438685085698",
        "parentId": "1638828389840322562",
        "deptName": "测试",
        "deptCategory": -1,
        "responsibilityUserId": "1640550604273209345",
        "children": [{
            "id": "1644257867491520513",
            "parentId": "1644256438685085698",
            "deptName": "测试新增用户1",
            "deptCategory": -1,
            "responsibilityUserId": "1644257868464599042",
            "hasChildren": false,
            "responsibilityUserName": "雨虹鱼",
            "responsibilityUserAccount": "16766565677"
        }, {
            "id": "1645310543960506370",
            "parentId": "1644256438685085698",
            "deptName": "测试打开",
            "deptCategory": -1,
            "responsibilityUserId": -1,
            "hasChildren": false,
            "responsibilityUserName": "",
            "responsibilityUserAccount": ""
        }, {
            "id": "1645311379478446081",
            "parentId": "1644256438685085698",
            "deptName": "CEUI23",
            "deptCategory": -1,
            "responsibilityUserId": -1,
            "hasChildren": false,
            "responsibilityUserName": "",
            "responsibilityUserAccount": ""
        }],
        "hasChildren": false,
        "responsibilityUserName": "刘欣2",
        "responsibilityUserAccount": "15069132762"
    }, {
        "id": "1646061406329630722",
        "parentId": "1638828389840322562",
        "deptName": "巡检三组0412",
        "deptCategory": -1,
        "responsibilityUserId": "1646061454501212161",
        "hasChildren": false,
        "responsibilityUserName": "人员新增",
        "responsibilityUserAccount": "14412345999"
    }, {
        "id": "1646062103099867138",
        "parentId": "1638828389840322562",
        "deptName": "巡检三组0412-1",
        "deptCategory": -1,
        "responsibilityUserId": -1,
        "hasChildren": false,
        "responsibilityUserName": "",
        "responsibilityUserAccount": ""
    }, {
        "id": "1646063890569719810",
        "parentId": "1638828389840322562",
        "deptName": "巡检三组0412-2",
        "deptCategory": -1,
        "responsibilityUserId": -1,
        "hasChildren": false,
        "responsibilityUserName": "",
        "responsibilityUserAccount": ""
    }, {
        "id": "1646065243601858561",
        "parentId": "1638828389840322562",
        "deptName": "巡检三组0412-10",
        "deptCategory": -1,
        "responsibilityUserId": -1,
        "hasChildren": false,
        "responsibilityUserName": "",
        "responsibilityUserAccount": ""
    }, {
        "id": "1640266111708598274",
        "parentId": "1638828389840322562",
        "deptName": "巡检一组",
        "deptCategory": -1,
        "responsibilityUserId": "1640550604273209345",
        "children": [{
            "id": "1640266369184337921",
            "parentId": "1640266111708598274",
            "deptName": "A组",
            "deptCategory": -1,
            "responsibilityUserId": -1,
            "hasChildren": false,
            "responsibilityUserName": "",
            "responsibilityUserAccount": ""
        }, {
            "id": "1641360670085111810",
            "parentId": "1640266111708598274",
            "deptName": "B组",
            "deptCategory": -1,
            "responsibilityUserId": -1,
            "hasChildren": false,
            "responsibilityUserName": "",
            "responsibilityUserAccount": ""
        }],
        "hasChildren": false,
        "responsibilityUserName": "刘欣2",
        "responsibilityUserAccount": "15069132762"
    }, {
        "id": "1640266431599775746",
        "parentId": "1638828389840322562",
        "deptName": "巡检二组1",
        "deptCategory": -1,
        "responsibilityUserId": "1640550604273209345",
        "hasChildren": false,
        "responsibilityUserName": "刘欣2",
        "responsibilityUserAccount": "15069132762"
    }, {
        "id": "1641360736178954241",
        "parentId": "1638828389840322562",
        "deptName": "巡检三组",
        "deptCategory": -1,
        "responsibilityUserId": -1,
        "children": [{
            "id": "1641369205443420162",
            "parentId": "1641360736178954241",
            "deptName": "1测试D组",
            "deptCategory": -1,
            "responsibilityUserId": "1640550604273209345",
            "hasChildren": false,
            "responsibilityUserName": "刘欣2",
            "responsibilityUserAccount": "15069132762"
        }, {
            "id": "1641361972986929154",
            "parentId": "1641360736178954241",
            "deptName": "测试A组",
            "deptCategory": -1,
            "responsibilityUserId": -1,
            "hasChildren": false,
            "responsibilityUserName": "",
            "responsibilityUserAccount": ""
        }, {
            "id": "1641367529785417729",
            "parentId": "1641360736178954241",
            "deptName": "测试B组",
            "deptCategory": -1,
            "responsibilityUserId": -1,
            "hasChildren": false,
            "responsibilityUserName": "",
            "responsibilityUserAccount": ""
        }, {
            "id": "1641367868005703681",
            "parentId": "1641360736178954241",
            "deptName": "巡检三组-测试N组",
            "deptCategory": -1,
            "responsibilityUserId": "1640550604273209345",
            "children": [{
                "id": "1641612761185665026",
                "parentId": "1641367868005703681",
                "deptName": "测试YHY",
                "deptCategory": -1,
                "responsibilityUserId": -1,
                "hasChildren": false,
                "responsibilityUserName": "",
                "responsibilityUserAccount": ""
            }],
            "hasChildren": false,
            "responsibilityUserName": "刘欣2",
            "responsibilityUserAccount": "15069132762"
        }],
        "hasChildren": false,
        "responsibilityUserName": "",
        "responsibilityUserAccount": ""
    }],
    "hasChildren": false,
    "responsibilityUserName": "",
    "responsibilityUserAccount": ""
}]

function getDept(list, id) {
    for (let i = 0; i < list.length; i++) {
        if (id.includes(list[i].id)) {
            return list[i]
        }
        if (list[i].children) {
            return getDept(list[i].children, id)
        }
    }
}
